import { defHttp } from '@/utils/http/axios';
import { ActivityCountInfo, ListItem, ListItemGetResultModel, listParams } from './model/activityListModel';

enum Api {
    list = '/admin/op/activity/list',
    getActivityInfo = '/admin/op/activity/getActivityInfo',
    getActivityCountInfo = '/admin/op/activity/getActivityCountInfo',
    createDetailsQrcode = '/admin/op/activity/createDetailsQrcode'
}

/**
 * @description 活动列表
 * @date 13/07/2022
 * @export
 */
export function list(params: listParams) {
    return defHttp.post<ListItemGetResultModel>({
        url: `${Api.list}?current=${params.current}&size=${params.size}`,
        params,
    });
}

/**
 * @description 获取活动详情二维码
 * @date 13/07/2022
 * @export
 */
export function createDetailsQrcode(id: number) {
    return defHttp.get<string>({
        url: Api.createDetailsQrcode + '/' + id,
    });
}


/**
 * @description 获取活动详情
 * @date 13/07/2022
 * @export
 */
export function getActivityInfo(id: number) {
    return defHttp.get<ListItem>({
        url: Api.getActivityInfo + '/' + id,
    });
}

/**
 * 活动详情统计数据
 * @param id 
 * @returns 
 */
export function getActivityCountInfo(id: number) {
    return defHttp.get<ActivityCountInfo>({
        url: Api.getActivityCountInfo + '/' + id,
    });
}


